import React, {useState} from 'react';
import One from "./components/One";
import Two from "./components/Two";

function App(props) {
    console.log("app-render")
    const [num,setNum] = useState(100);
    const [userName,setUserName] = useState("zhangsan");
    const [obj,setObj] = useState({
        a:1
    })
    return (
        <div>
            <h3>App</h3>
            <button onClick={()=>setNum(num+1)}>{num}</button>
            <button onClick={()=>{
                obj.a = 10;
                setObj({
                    a:10
                });
            }}>{obj.a}</button>
            <button onClick={()=>setUserName("lisi")}>userName:{userName}</button>
            <hr/>
            <One num={num}/>
            <hr/>
            <Two/>
        </div>
    );
}

export default App;